package com.jmyd.sharding.server.domain.po;

import com.jmyd.sharding.server.domain.dto.UserDto;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;

/**
 * @author samphin
 * @date 2021/8/5 10:05
 */
@Data
public class TUser {

    @Id
    private Long id;

    /**
     * 名称
     */
    @Column(name = "`name`")
    private String name;

    /**
     * 城市
     */
    @Column(name = "city_id")
    private Integer cityId;

    /**
     * 性别
     */
    @Column(name = "sex")
    private Integer sex;

    /**
     * 电话
     */
    @Column(name = "phone")
    private String phone;

    /**
     * 邮箱
     */
    @Column(name = "email")
    private String email;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 密码
     */
    @Column(name = "`password`")
    private String password;

    public TUser build(UserDto dto) {
        BeanUtils.copyProperties(dto, this);
        return this;
    }
}